package adapter;

import java.util.ArrayList;

import com.adgroup.smartnote.R;
import com.androidquery.AQuery;

import JsonModel.Category;
import adapter.AdapterUserLogo.Holder;
import android.app.Activity;
import android.content.Context;
import android.graphics.Bitmap;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;

public class AdapterCategories{

	ArrayList<Category> arr;
	Context context;
	public AdapterCategories(Context c, ArrayList<Category> arr)
	{
		this.arr = arr;
		context = c;
	}
	public class Holder
	{
		public TextView tv;
	}
	public class Adapter extends BaseAdapter
	{

		@Override
		public int getCount() {
			return arr.size();
		}

		@Override
		public Object getItem(int position) {
			return arr.get(position);
		}

		@Override
		public long getItemId(int position) {
			// TODO Auto-generated method stub
			return position;
		}

		@Override
		public View getView(int position, View arg1, ViewGroup parent) {
			Holder holder;
			LayoutInflater inflater = ((Activity) context).getLayoutInflater();
			if (arg1 == null) {
				holder = new Holder();
				arg1 = inflater.inflate(R.layout.itemcategory, null);
				holder.tv = (TextView) arg1
						.findViewById(R.id.textViewCategory);
				arg1.setTag(holder);
			} else {
				holder = (Holder) arg1.getTag();
			}
			String s = arr.get(position).getName();
			holder.tv.setText(arr.get(position).getName());
			Log.d("log",holder.tv.getText().toString());
			return arg1; 
		}
		
	}
}
